package com.weipai.springboot.module.dao.impl;

import com.weipai.springboot.model.CashRecord;
import com.weipai.springboot.module.dao.CashRecordDao;
import com.weipai.springboot.module.mapper.CashRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author songmengqiang
 * @create 2018-09-26 17:46
 **/
@Repository
public class CashRecordDaoImpl implements CashRecordDao {

    @Autowired
    private CashRecordMapper cashRecordMapper;

    @Override
    public int save(CashRecord cashRecord) {
        return cashRecordMapper.insertSelective(cashRecord);
    }

    @Override
    public int update(CashRecord cashRecord) {
        return cashRecordMapper.updateByPrimaryKeySelective(cashRecord);
    }

    @Override
    public List<CashRecord> queryByCustomerId(String customerId) {
        return cashRecordMapper.queryByCustomerId(customerId);
    }

    @Override
    public int getCashAmount(String customerId) {
        return cashRecordMapper.getCashAmount(customerId);
    }


}
